package com.apes.fico.engine.model;

import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.Model;
import com.apes.framework.jpa.Name;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.jpa.generator.ApesGenerator;
import com.apes.framework.plugin.soe.metadata.BusinessField;
import com.apes.framework.plugin.soe.metadata.BusinessType;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;

/**
 * @program: apestech
 * @description: 要素
 * @author: Chengxm
 * @create: 2019-01-24 15:53
 **/
@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = Element.CONST_TABLE_NAME)
public class Element extends Model {
    public final static String CONST_TABLE_NAME ="fin_element";
    @Id
    @Column(name = "id", length = 8)
    @ApesGenerator(code = CONST_TABLE_NAME, name = "要素")
    @Comment("编码")
    private String id;

    @Name
    @Comment("通用属性")
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "business_field_id", referencedColumnName = "id", nullable = false)
    private BusinessField businessField;

    @Name
    @Column(name = "strategy", nullable = false)
    @Comment("执行策略")
    private String strategy;

    @Name
    @Column(name = "description", nullable = false)
    @Comment("描述")
    private String description;
}
